<template>
  <div class="padding-lr20">
    <div
      class="record_li flex padding-tb20"
      v-for="(item,index) in list"
      :key="index"
      @click="to(item.user_id)"
    >
      <img class="radius-50p margin-r24" :src="item.head_img?item.head_img:$nologin" alt />
      <div class="flex-grow flex flex-column text-content">
        <div class="rem-30px overflow-hidden">{{item.user_name?item.user_name:item.user_phone}}</div>
        <div class="rem-24px overflow-hidden">
          <span class="fl">{{item.user_phone}}</span>
          <span class="fr c-99">{{item.created_at}}</span>
        </div>
      </div>
    </div>
    <load @loadData="getData" :list="list" :total="total" :nodata="list.length<10?true:false"></load>
  </div>
</template>

<script>
import load from "../components/load";
export default {
  components: {
    load
  },
  data() {
    return {
      list: [],
      total: 0,
      page: 1
    };
  },
  mounted() {
    document.querySelector("html").style.backgroundColor = "#ffffff";
    this.getData(1);
  },
  methods: {
    getData(page) {
      this.$axios
        .post("/home/record/browsing", {
          token: window.localStorage.getItem("qx_token"),
          page: page,
          limit: 10
        })
        .then(res => {
          if (page == 1) {
            this.list = [];
            this.topList = [];
          }
          if (res.data.data.data.length == 0) {
            this.total++;
            return false;
          }
          for (let i in res.data.data.data) {
            this.list.push(res.data.data.data[i]);
          }
        });
    },
    to(id) {
      this.$router.push({
        path: "/recruit/card",
        query: {
          id: id
        }
      });
    }
  }
};
</script>

<style scoped>
.record_li img {
  width: 0.96rem;
  height: 0.96rem;
}
.border-bottom:last-of-type {
  border: none;
}
</style>